from pydantic_settings import BaseSettings
from typing import Optional, List

class Settings(BaseSettings):
    """
    应用配置 (v2.1 - 仅 Nonce 认证)
    """
    # --- 应用元数据 ---
    APP_NAME: str = "how2solutions-2API"
    APP_VERSION: str = "2.1.0"
    DESCRIPTION: str = "一个将 how2solutions.com 问答功能转换为兼容 OpenAI 格式 API 的高性能代理。"

    # --- 认证与安全 ---
    API_MASTER_KEY: Optional[str] = "sk-how2solutions-default-key"

    # --- how2solutions 认证信息 ---
    # 从 .env 文件读取的 Nonce
    HOW2SOLUTIONS_NONCE: Optional[str] = None

    # --- 请求配置 ---
    API_REQUEST_TIMEOUT: int = 180

    # --- Nginx 端口 ---
    NGINX_PORT: int = 8089

    # --- 模型定义 ---
    DEFAULT_MODEL: str = "how2solutions-ai"
    KNOWN_MODELS: List[str] = [
        "how2solutions-ai",
    ]

    class Config:
        env_file = ".env"
        env_file_encoding = 'utf-8'
        extra = "ignore"

settings = Settings()
